package com.woniu.p2p.serviceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.p2p.mapper.UserInvestMapper;
import com.woniu.p2p.service.MydepositsHistoryService;
import com.woniu.p2p.vo.MydepositsHistoryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MydepositsHistoryServiceImpl implements MydepositsHistoryService {

    @Autowired
    UserInvestMapper userInvestMapper;

    @Override
    public PageInfo<MydepositsHistoryVo> findAllDepositsByUserIdAndInvestId(Integer UserId, Integer TypeId,Integer start) {
        PageHelper.startPage(start,100);
        List<MydepositsHistoryVo> list = userInvestMapper.findAllDepositsByUserIdAndInvestId(UserId, TypeId);
        for (MydepositsHistoryVo my:list
             ) {
            if(my.getDepositsGetMoney()!=0){
                my.setDepositsStatus("正在收益");
            }else {
                my.setDepositsStatus("收益已结束");
            }
        }
        PageInfo<MydepositsHistoryVo> pageInfo=new PageInfo<>(list);
        return pageInfo;
    }
}
